package com.oa.order.service;

import java.util.Map;

import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;

import com.oa.order.dto.OrderDTO;
import com.oa.order.entity.Order;

public interface OrderService {
	// 报餐业务
	public void save(Order order);

	public void delete(Long orderId);

	public Order findOne(Long orderId);
	
	public Page<Order> findByOne(String userName, Pageable pageable);
	
	//订餐业务:快捷查询(可扩展)
	public Page<Order> findAll(Specification<Order> spec, Pageable pageable);
	
	//流程业务
	//1.启动流程
	public ProcessInstance startWorkflow(Long orderId, Map<String, Object> variables);//findOne(Long orderId);
	//2.查询流程任务
	public Page<OrderDTO> findTodoTasks(Long userId, Pageable pageable);
	
	//3.签收流程任务
	public void claim(String taskId,String orderId);
	
	//4.完成流程任务
	public void complete(String taskId, Map<String, Object> variables);
        
	//5.结束(终止)流程实例
	
	//6.查询运行中的流程
	public Page<OrderDTO> findRunningProcessInstaces(Page<Order> page, int[] pageParams);
	//7.查询已结束的流程
	public Page<OrderDTO> findFinishedProcessInstaces(Page<Order> page, int[] pageParams);
	//8.查询流程定义对象
	//protected ProcessDefinition getProcessDefinition(String processDefinitionId);

	

}
